<template>
    <div class="login">
        <a-button @click="$router.push('/love')" shape="round" class="back" size="large">
            <template #icon>
                <icon-home />
            </template>
        </a-button>
        <div class="login-wrap">
            <div class="login-left" >
                <div v-html="slogan"></div>
            </div>
            <div class="login-right" >
                <div class="login-right-wrap">
                    <h3 class="title">{{title}}</h3>
                    <!-- 标签选项 -->
                    <Tabs style="margin-bottom:10px;" v-model:tag="loginType" :tagList="tagList" @tab-click="taggleTag"/>
                    <!-- 操作表单 -->
                    <tags-form :loginType="loginType" :tagList="tagList"></tags-form>
                    <!-- 第三方登录 -->
                   

                </div>
            </div>
        </div>
    </div>
</template>
<script setup>
import { ref, watch} from 'vue';
import { useRoute, useRouter } from 'vue-router';
import TagsForm from './TagsForm.vue';
import Tabs from '@/components/Tabs.vue'
//标题
const title=ref("")
//项目名称
const app_name=import.meta.env.VITE_APP_NAME
///项目 slogan
const slogan=import.meta.env.VITE_APP_LOGIN_SLOGAN
// 登录类型：0：登录，1：注册，2：找回密码
const loginType=ref(0)
const tagList=[
    {
        name:'登录',
        loginType:0,
        title:`登录MGO音乐`
    },
    {
        name:'注册',
        loginType:1,
        title:`注册MGO音乐`
    }
]
//
const route=useRoute()
//
const router=useRouter();
// 选择标签
const checkTag=(type)=>{
    type=parseInt(type)
    switch(type){
        case 0:
            loginType.value=0
            break
        case 1:
            loginType.value=1
            break
        case 2:
            loginType.value=2
            break
        default:loginType.value=0
    }
    title.value=tagList[loginType.value].title
}
checkTag(route.query.type)
//侦听器
watch(()=>route.query.type,(type)=>{    
    checkTag(type)
})
// 选择标签
const taggleTag=(val)=>{
    router.push({
        name:"Login",
        query:{
            type:val
        }
    })
}
console.log(app_name)

</script>
<style lang="less" scoped>
@import '@/assets/styles/config.less';
.login{
    background-image:  url('@/assets/img/login_bg.jpg');
    background-size: cover;
    background-attachment:fixed;
    position: relative;
    .back {
        position: absolute;
        top: 30px;
        left: 59px;
        font-size: 20px;
        color: var(--color-text-2);
        z-index: 999;
    }
    ::v-deep(.simple) {
        padding: 5px 40px;
    }
    .login-wrap{
        min-height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
        .login-left,.login-right{
            flex:1;
        }
        .login-left{
            font-size: 2rem;
            font-weight: 500;
            padding: 0 30px;
            line-height: 1.4;
            color: var(--color-bg-1);
            display: flex;
            justify-content: center;
            font-family:"华文彩云";/*设置字体*/
            font-size:64px; /*设置字体大小*/
            font-weight:bolder; /*设置字体粗细*/
            -webkit-text-stroke:1px #fff;        /*文字描边*/
            -webkit-text-fill-color:transparent;    /*设置文字的填充颜色*/

        }
        .login-right{
            display: flex;
            justify-content: center;
            box-sizing: border-box;
            width: 100%;
            .login-right-wrap{
                width: 400px;
                padding: 50px;
                margin: 60px 10px;
                background: var(--color-bg-1);
                border-radius: @border-radius-2large;
                box-shadow: var(--shadow-3);
                max-width: 450px;
                min-width: 300px;
                box-sizing: border-box;
                .title{
                    font-size: 30px;
                    margin-bottom: 40px;
                    text-align: center;
                    color: rgb(var(--primary-5));
                    font-family:"华文彩云,PingFang";/*设置字体*/
                    font-weight:bolder; /*设置字体粗细*/
                    -webkit-text-stroke:1px rgb(var(--primary-6));        /*文字描边*/
                    -webkit-text-fill-color:transparent;    /*设置文字的填充颜色*/
                }
                .tripa_login{
                    display: flex;
                    height: 40px;
                    width: 100%;
                    align-items: center;
                    .tripa{
                        margin:0 5px;
                        height: 100%;
                        border-radius:  @border-radius-small;
                        border: 1px solid var(--color-fill-1);
                        box-shadow: -4px 4px 10px rgba(0, 0, 0, 0.1);
                        transition: all .3s;
                        display: flex;
                        justify-content: center;
                        align-items:center;
                        background: var(--color-bg-4) url(@/assets/img/login_btn_bg.svg);
                        background-size:contain;
                        background-repeat:no-repeat;
                        background-position:center;

                        img{
                            height: 60%;
                        }
                        &:hover{
                            box-shadow: -4px 4px 20px rgba(0, 0, 0, 0.1);
                        }
                    }
                }
            }
            
        }
    }

}
@media screen and(max-width: @device_boundary) {
    .login{
         .login-wrap{
             .login-left{
                 display: none;
             }
             .login-right{
                 background: rgba()var(--color-bg-1);
             }
         }
    }
}

</style>
